package com.catarc.unityback.entity.exception;

import com.catarc.unityback.entity.constant.ResultCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serial;

/**
 * @author van
 * @date 2023/2/26 12:14
 */
@Data
@ToString
@EqualsAndHashCode(callSuper = true)
public class UnityBackException extends RuntimeException{

    @Serial
    private static final long serialVersionUID = 8669822979975640792L;
    private final String code;

    public UnityBackException(String message) {
        super(message);
        this.code = ResultCode.BIZ_ERROR.getCode();
    }

    public UnityBackException(String message, String code) {
        super(message);
        this.code = code;
    }

    public UnityBackException(ResultCode resultCode) {
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public UnityBackException(String message, ResultCode resultCode) {
        super(message);
        this.code = resultCode.getCode();
    }
}
